package cn.com.headfree.mouldshow.dao.impl;

import cn.com.headfree.entity.TSdtTutorPrentInfoTemp;
import cn.com.headfree.mouldshow.dao.TSdtTutorPrentInfoTempDao;
import com.gta.edu.sdk.base.dao.impl.BaseDaoImpl;
import org.springframework.stereotype.Repository;

import java.sql.Timestamp;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

@Repository("/tSdtTutorPrentInfoTempDao")
public class TSdtTutorPrentInfoTempDaoImpl extends BaseDaoImpl<TSdtTutorPrentInfoTemp> implements TSdtTutorPrentInfoTempDao {


    @Override
    public void saveInfo(TSdtTutorPrentInfoTemp tSdtTutorPrentInfo) {
        String sql = "insert into t_sdt_tutor_prent_info_temp (id,start_date,end_date,tutor_name,prent_name,teach_summary,erp_no,id_card_no,org_id,creater_id,creater_name,create_time,updater_id,updater_name,update_time,del_sign,is_valid,audit_state,orignal_id,business_type_id,primitive_id) values ";
        StringBuilder sqlBuilder = new StringBuilder(sql);
        sqlBuilder.append("(#{id,jdbcType=VARCHAR},").append("#{start_date,jdbcType=VARCHAR},")
                .append("#{end_date,jdbcType=VARCHAR},").append("#{tutor_name,jdbcType=VARCHAR},")
                .append("#{prent_name,jdbcType=VARCHAR},").append("#{teach_summary,jdbcType=VARCHAR},")
                .append("#{erp_no,jdbcType=VARCHAR},").append("#{id_card_no,jdbcType=VARCHAR},")
                .append("#{org_id,jdbcType=VARCHAR},").append("#{creater_id,jdbcType=VARCHAR},")
                .append("#{creater_name,jdbcType=DATE},").append("#{create_time,jdbcType=DATE},")
                .append("#{updater_id,jdbcType=VARCHAR},").append("#{updater_name,jdbcType=VARCHAR},")
                .append("#{update_time,jdbcType=DATE},").append("#{del_sign,jdbcType=INTEGER},")
                .append("#{is_valid,jdbcType=INTEGER},").append("#{audit_state,jdbcType=INTEGER},")
                .append("#{orignal_id,jdbcType=VARCHAR},").append("#{business_type_id,jdbcType=VARCHAR},")
                .append("#{primitive_id,jdbcType=VARCHAR})");
        Map<String, Object> params = new HashMap<String, Object>();
        params.put("id", tSdtTutorPrentInfo.getId());
        params.put("start_date", tSdtTutorPrentInfo.getStartDate());
        params.put("end_date", tSdtTutorPrentInfo.getEndDate());
        params.put("tutor_name", tSdtTutorPrentInfo.getTutorName());
        params.put("prent_name", tSdtTutorPrentInfo.getPrentName());
        params.put("teach_summary", tSdtTutorPrentInfo.getTeachSummary());
        params.put("erp_no", tSdtTutorPrentInfo.getErpNo());
        params.put("id_card_no", tSdtTutorPrentInfo.getIdCardNo());
        params.put("org_id", tSdtTutorPrentInfo.getOrgId());
        params.put("creater_id", tSdtTutorPrentInfo.getCreaterId());
        params.put("creater_name", tSdtTutorPrentInfo.getCreaterName());
        params.put("create_time", new Timestamp(new Date().getTime()));
        params.put("updater_id", tSdtTutorPrentInfo.getUpdaterId());
        params.put("updater_name", tSdtTutorPrentInfo.getUpdaterName());
        params.put("update_time", new Timestamp(new Date().getTime()));
        params.put("del_sign", 0);
        params.put("is_valid", tSdtTutorPrentInfo.getIsValid());
        params.put("audit_state", tSdtTutorPrentInfo.getAuditState());
        params.put("orignal_id", tSdtTutorPrentInfo.getOrignalId());
        params.put("business_type_id", tSdtTutorPrentInfo.getBusinessTypeId());
        params.put("primitive_id", tSdtTutorPrentInfo.getPrimitiveId());
        this.executeSql(sqlBuilder.toString(), params);
    }
}
